package com.qst.crop.dao;

import com.qst.crop.entity.Reserve;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ReserveDao {


    @Insert("insert into tb_reserve(expert_name, questioner, area, address, plant_name, soil_condition, plant_condition, plant_detail, phone, message, answer, status) " +
            "VALUES (#{expertName},#{questioner},#{area},#{address},#{plantName},#{soilCondition},#{plantCondition},#{plantDetail},#{phone},#{message},#{answer},#{status})")
    void insert(Reserve reserve);


    @Select("select * from tb_reserve where questioner = #{username}")
    List<Reserve> selectByKindQuestioner(String username);
    @Select("select * from tb_reserve where expert_name = #{username}")
    List<Reserve> selectByKindExport(String username);

    @Select("select * from tb_reserve where id=#{id}")
    Reserve selectById(Integer id);

    int update(Reserve reserve);

    @Delete("delete from tb_reserve where id=#{id}")
    int delById(Integer id);
}
